/**
 * Create by richliu1023
 * @date 2016-06-17
 * @email richliu1023@gmail.com
 * @github https://github.com/RichLiu1023
 * @description 方向标识
 */
class AxisMesh extends egret3d.Object3D {

	private _xMat;
	private _yMat;
	private _zMat;
	private _lineX;
	private _lineY;
	private _lineZ;
	private _boxX;
	private _boxY;
	private _boxZ;

	public constructor( axisSize = 100 ) {
		super();
		this._xMat = new egret3d.ColorMaterial( 0xff0000 );
		this._xMat.ambientColor = 0xf0f0f0;
		this._yMat = new egret3d.ColorMaterial( 0x00ff00 );
		this._yMat.ambientColor = 0xf0f0f0;
		this._zMat = new egret3d.ColorMaterial( 0x0000ff );
		this._zMat.ambientColor = 0xf0f0f0;
		var geom;
		var lineSize = axisSize / 100;
		geom = new egret3d.CubeGeometry( axisSize, lineSize, lineSize );
		this._lineX = new egret3d.Mesh( geom, this._xMat );
		this.addChild( this._lineX );
		geom = new egret3d.CubeGeometry( lineSize, axisSize, lineSize );
		this._lineY = new egret3d.Mesh( geom, this._yMat );
		this.addChild( this._lineY );
		geom = new egret3d.CubeGeometry( lineSize, lineSize, axisSize );
		this._lineZ = new egret3d.Mesh( geom, this._zMat );
		this.addChild( this._lineZ );
		var boxSize = axisSize / 25;
		var offset = (axisSize - boxSize) / 2;
		geom = new egret3d.CubeGeometry( boxSize, boxSize, boxSize );
		this._boxX = new egret3d.Mesh( geom, this._xMat );
		this._boxX.position = new egret3d.Vector3D( offset, 0, 0 );
		this.addChild( this._boxX );
		this._boxY = new egret3d.Mesh( geom, this._yMat );
		this._boxY.position = new egret3d.Vector3D( 0, offset, 0 );
		this.addChild( this._boxY );
		this._boxZ = new egret3d.Mesh( geom, this._zMat );
		this._boxZ.position = new egret3d.Vector3D( 0, 0, offset );
		this.addChild( this._boxZ );
	}

}